#ifndef __WIZ_BASE_TYPE_CHAR_HPP__SHANHAOBO_19800429__
#define __WIZ_BASE_TYPE_CHAR_HPP__SHANHAOBO_19800429__

#include <mbstring.h>

#include "../Core/WizBaseCoreTypeChar.hpp"

namespace Wiz
{
    //////////////////////////////////////////////////////////////////////////

    WIZ_INLINE ::Wiz::Bool::Type IsAlpha(::Wiz::Char::In c)
    {
        return isalpha(c) != 0;
    }

    WIZ_INLINE ::Wiz::Bool::Type IsAlpha(::Wiz::WChar::In c)
    {
        return iswalpha(c) != 0;
    }

    WIZ_INLINE ::Wiz::Bool::Type IsDigit(::Wiz::Char::In c)
    {
        return isdigit(c) != 0;
    }

    WIZ_INLINE ::Wiz::Bool::Type IsDigit(::Wiz::WChar::In c)
    {
        return iswdigit(c) != 0;
    }

    WIZ_INLINE ::Wiz::Bool::Type IsBlank(::Wiz::Char::In c)
    {
        return (c == ' ') || (c == '\t') || (c == '\r') || (c == '\n');
    }

    WIZ_INLINE ::Wiz::Bool::Type IsBlank(::Wiz::WChar::In c)
    {
        return (c == L' ') || (c == L'\t') || (c == L'\r') || (c == L'\n');
    }

    WIZ_INLINE ::Wiz::Bool::Type IsSpace(::Wiz::Char::In c)
    {
        return isspace(c) != 0;
    }

    WIZ_INLINE ::Wiz::Bool::Type IsSpace(::Wiz::WChar::In c)
    {
        return iswspace(c) != 0;
    }

    WIZ_INLINE ::Wiz::Char::Type ToLower(::Wiz::Char::In c)
    {
        return tolower(c);
    }

    WIZ_INLINE ::Wiz::WChar::Type ToLower(::Wiz::WChar::In c)
    {
        return towlower(c);
    }

    WIZ_INLINE ::Wiz::Char::Type ToUpper(::Wiz::Char::In c)
    {
        return toupper(c);
    }

    WIZ_INLINE ::Wiz::WChar::Type ToUpper(::Wiz::WChar::In c)
    {
        return towupper(c);
    }

    //////////////////////////////////////////////////////////////////////////

    WIZ_INLINE ::Wiz::Bool::Type StrCmp(
        ::Wiz::Char::FixedConstPtr Str1,
        ::Wiz::Char::FixedConstPtr Str2
        )
    {
        return ::strcmp(Str1, Str2) == 0;
    }
    WIZ_INLINE ::Wiz::Bool::Type StrCmpIgnoreCase(
        ::Wiz::Char::FixedConstPtr Str1,
        ::Wiz::Char::FixedConstPtr Str2
        )
    {
        return ::stricmp(Str1, Str2) == 0;
    }

    WIZ_INLINE ::Wiz::Bool::Type StrCmp(
        ::Wiz::MBChar::FixedConstPtr Str1,
        ::Wiz::MBChar::FixedConstPtr Str2
        )
    {
        return ::_mbscmp(Str1, Str2) == 0;
    }
    WIZ_INLINE ::Wiz::Bool::Type StrCmpIgnoreCase(
        ::Wiz::MBChar::FixedConstPtr Str1,
        ::Wiz::MBChar::FixedConstPtr Str2
        )
    {
        return ::_mbsicmp(Str1, Str2) == 0;
    }

    WIZ_INLINE ::Wiz::Bool::Type StrCmp(
        ::Wiz::WChar::FixedConstPtr Str1,
        ::Wiz::WChar::FixedConstPtr Str2
        )
    {
        return ::wcscmp(Str1, Str2) == 0;
    }
    WIZ_INLINE ::Wiz::Bool::Type StrCmpIgnoreCase(
        ::Wiz::WChar::FixedConstPtr Str1,
        ::Wiz::WChar::FixedConstPtr Str2
        )
    {
        return ::wcsicmp(Str1, Str2) == 0;
    }

    WIZ_INLINE ::Wiz::Bool::Type StrCmp(
        ::Wiz::UInt16::FixedConstPtr Str1,
        ::Wiz::UInt16::FixedConstPtr Str2
        )
    {
        return ::wcscmp((::Wiz::WChar::FixedConstPtr)Str1, (::Wiz::WChar::FixedConstPtr)Str2) == 0;
    }
    WIZ_INLINE ::Wiz::Bool::Type StrCmpIgnoreCase(
        ::Wiz::UInt16::FixedConstPtr Str1,
        ::Wiz::UInt16::FixedConstPtr Str2
        )
    {
        return ::wcsicmp((::Wiz::WChar::FixedConstPtr)Str1, (::Wiz::WChar::FixedConstPtr)Str2) == 0;
    }

    /// Fix Me : UCS32 equal UCS16
    WIZ_INLINE ::Wiz::Bool::Type StrCmp(
        ::Wiz::UInt32::FixedConstPtr Str1,
        ::Wiz::UInt32::FixedConstPtr Str2
        )
    {
        return ::wcscmp((::Wiz::WChar::FixedConstPtr)Str1, (::Wiz::WChar::FixedConstPtr)Str2) == 0;
    }
    WIZ_INLINE ::Wiz::Bool::Type StrCmpIgnoreCase(
        ::Wiz::UInt32::FixedConstPtr Str1,
        ::Wiz::UInt32::FixedConstPtr Str2
        )
    {
        return ::wcsicmp((::Wiz::WChar::FixedConstPtr)Str1, (::Wiz::WChar::FixedConstPtr)Str2) == 0;
    }
    ///////////////////////////////////////////////////
    ///////////////////////////////////////////////////
    ///////////////////////////////////////////////////
} /// end of namespace Wiz

#endif /*__WIZ_BASE_TYPE_CHAR_HPP__SHANHAOBO_19800429__*/
